﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Misuzilla.Crigate.Authenticate;
using Misuzilla.Net.Irc;

namespace Crigate
{
    class SettingsAuthorizer : IAuthorizer
    {
        private Settings _settings;
        public SettingsAuthorizer(Settings settings)
        {
            _settings = settings;
        }
        
        #region IAuthorizer メンバ

        public AuthenticateResult Authenticate(Misuzilla.Crigate.Session session, Misuzilla.Crigate.UserInfo userInfo)
        {
            if ((userInfo.UserName != _settings.UserName) || (userInfo.Password != _settings.Password))
                return new AuthenticateResult(ErrorReply.ERR_PASSWDMISMATCH, "Invalid Password");
            
            return new AuthenticateResult();
        }

        #endregion
    }
}
